<?php
function UpdateShipsForSortie($pilot,$sort) {

	global $lang;
	global $VIEW;
	global $link;
	global $SERVER;

	// CHECK if pilot sinked smt
	$r = mysql_query("
		select
			killedid as id
		from
			killboard
		where
			killerid='$pilot'
				and
			killedground='1'
				and
			killersortieid='$sort'
		");

	while ($shipid = mysql_fetch_assoc($r)) {

    	$sclass = "";

		$shipid=$shipid[id];

		// GET ship name
		$shipname_r = mysql_query("
			select
				callsign as name
			from
				pilots
			where
				id='$shipid'
		");

		$shipname = mysql_fetch_assoc($shipname_r);
		$shipname = $shipname[name];


		// GET Ship CLASS
		$shipclass_r = mysql_query("
			select
				class
			from
				ships
			where
				name='$shipname'
		");


		while ($shipclass = mysql_fetch_assoc($shipclass_r)) {

			$sclass = $shipclass["class"];

		}

	    if ($sclass) {

    		mysql_query("
	        	update
					finalpilots
            	set
                    $sclass=$sclass+1
                where
                	pilotid='$pilot'
        	");
    	}


?>